
$(function () {
    $('#submit').click(function (event) {
       event.preventDefault();

        var emailE = $('input[name="email"]');
        var captchaE = $('input[name="captcha"]');

        var email = emailE.val();
        var captcha = captchaE.val();
        if(!captcha||!email){
            xtalert.alertInfo('请将数据填写完整！');
            return;
        }
        zlajax.post({
           'url' : '/cms/resetemail/' ,
            'data' : {
               'email' : email,
                'captcha' : captcha
            },
            'success' : function (data) {
               if (data['code'] == 200){
                   emailE.val('');
                   captchaE.val('');
                   xtalert.alertSuccessToast('邮箱修改成功！');
               }else {
                   xtalert.alertInfo(data['message']);
               }
            },
            'fail' : function (error) {
                xtalert.alertNetworkError();
            }
        });
    });
});